package mutt.shared;

import java.util.HashMap;

/**
 * Enum containing text strings in different languages for all of the used labels
 * Current available languages: English, Estonian
 * 
 * SERVER_ERROR  - connection error message
 * qButtonName - button's label which sends the user's query
 * nameFieldLabel - label for the user input field
 * errorLabelText
 * invalid_input - label for invalid input
 * serverResponseLabelText
 * DialogBoxOnFailure - label for dialog box on failed query
 * DialogBoxOnSuccess - label for dialog box on successful query
 * htmlPostLine - label for query posted to server
 * htmlResponseLine - label for server response
 * commandLabel - label which request the user to enter query
 * closeButtonName - button's label which closes the dialog box pop-up
 */
public enum Lang {

	English(new HashMapBuilder<Labels, String>()
			.put(Labels.SERVER_ERROR,
					"An error occurred while "
							+ "attempting to contact the server. "
							+ "Please check your network "
							+ "connection and try again.")//
			.put(Labels.qButtonName, "LiveTyping")//
			.put(Labels.nameFieldLabel, "Enter query here")//
			.put(Labels.errorLabelText, "")//
			.put(Labels.invalid_input,
					"Please enter at least 1 character long query")//
			.put(Labels.serverResponseLabelText, "")//
			.put(Labels.DialogBoxOnFailure, "Epic fail")//
			.put(Labels.DialogBoxOnSuccess, "Query result")//
			.put(Labels.htmlPostLine, "<b>Sent query:</b>")//
			.put(Labels.htmlResponseLine, "<br><b>Server replies:</b>")//
			.put(Labels.commandlabel, "Please enter your query:")//
			.put(Labels.closeButtonName, "Close")//
			.build()), //

	Estonian(new HashMapBuilder<Labels, String>()
			.put(Labels.SERVER_ERROR,
					"Ilmnes viga serveriga suhtlemisel. "
							+ "Kontrolli oma päringut ja interneti ühendust, "//
							+ "ning proovi uuesti.")//
			.put(Labels.qButtonName, "LiveTyping")//
			.put(Labels.nameFieldLabel, "Sisesta päring siia")//
			.put(Labels.errorLabelText, "")//
			.put(Labels.invalid_input,
					"Sisesta päring, mis on vähemalt 1 tähtmärk pikk")//
			.put(Labels.serverResponseLabelText, "")//
			.put(Labels.DialogBoxOnFailure, "Ilmnes viga")//
			.put(Labels.DialogBoxOnSuccess, "Päringu tulem")//
			.put(Labels.htmlPostLine, "<b>Saadetud päring::</b>")//
			.put(Labels.htmlResponseLine, "<br><b>Server vastas:</b>")//
			.put(Labels.commandlabel, "Palun sisesta oma päring:")//
			.put(Labels.closeButtonName, "Sulge")//
			.build());

	public enum Labels {
		SERVER_ERROR, qButtonName, nameFieldLabel, errorLabelText, //
		invalid_input, serverResponseLabelText, DialogBoxOnFailure, //
		DialogBoxOnSuccess, htmlPostLine, htmlResponseLine, //
		closeButtonName, titlelabel, commandlabel
	}

	private HashMap<Labels, String> language;

	private Lang(HashMap<Labels, String> language) {
		this.language = language;
	}

	public String _(Labels query) {
		return language.get(query);
	}
}